hotplug/Linux: Remove hardcoded paths
authorIan Campbell <ian.campbell@citrix.com>
Tue, 5 Feb 2013 16:19:52 +0000 (16:19 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Thu, 11 Apr 2013 12:19:57 +0000 (13:19 +0100)
Use xen-hotplugpath.sh (as NetBSD does) which allows PREFIX etc to change.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Roger Pau Monne <roger.pau@citrix.com>
tools/hotplug/Linux/init.d/xen-watchdog
tools/hotplug/Linux/init.d/xencommons
tools/hotplug/Linux/init.d/xend
tools/hotplug/Linux/init.d/xendomains

index 55dd0910937d2a9cb12039477635d6b482504084..3592fda32d3658b1efc1419808e8bab4c866a279 100644 (file)
@@ -17,7 +17,9 @@
 ### END INIT INFO
 #
 
-DAEMON=/usr/sbin/xenwatchdogd
+. /etc/xen/scripts/hotplugpath.sh
+
+DAEMON=${SBINDIR}/xenwatchdogd
 base=$(basename $DAEMON)
 
 # Source function library.
index 20afcc0a3b385ca8e75ebb3ea5e12eb8991dbb24..a2e633b27a4450d45af51bffc650620570cccb48 100644 (file)
@@ -18,6 +18,8 @@
 # Description:       Starts and stops the daemons neeeded for xl/xend
 ### END INIT INFO
 
+. /etc/xen/scripts/hotplugpath.sh
+
 if [ -d /etc/sysconfig ]; then
        xencommons_config=/etc/sysconfig
 else
@@ -72,7 +74,7 @@ do_start () {
        modprobe blktap2 2>/dev/null || modprobe blktap 2>/dev/null
        mkdir -p /var/run/xen
 
-       if ! `xenstore-read -s / >/dev/null 2>&1`
+       if ! `${BINDIR}/xenstore-read -s / >/dev/null 2>&1`
        then
                test -z "$XENSTORED_ROOTDIR" && XENSTORED_ROOTDIR="/var/lib/xenstored"
                rm -f "$XENSTORED_ROOTDIR"/tdb* &>/dev/null
@@ -81,19 +83,19 @@ do_start () {
                if [ -n "$XENSTORED" ] ; then
                    echo -n Starting $XENSTORED...
                    $XENSTORED --pid-file /var/run/xenstored.pid $XENSTORED_ARGS
-               elif [ -x /usr/sbin/oxenstored ] ; then
+               elif [ -x ${SBINDIR}/oxenstored ] ; then
                    echo -n Starting oxenstored...
-                   /usr/sbin/oxenstored --pid-file /var/run/xenstored.pid $XENSTORED_ARGS
-               elif [ -x /usr/sbin/xenstored ] ; then
+                   ${SBINDIR}/oxenstored --pid-file /var/run/xenstored.pid $XENSTORED_ARGS
+               elif [ -x ${SBINDIR}/xenstored ] ; then
                    echo -n Starting C xenstored...
-                   /usr/sbin/xenstored --pid-file /var/run/xenstored.pid $XENSTORED_ARGS
+                   ${SBINDIR}/xenstored --pid-file /var/run/xenstored.pid $XENSTORED_ARGS
                else
                    echo "No xenstored found"
                    exit 1
                fi
 
                # Wait for xenstored to actually come up, timing out after 30 seconds
-                while [ $time -lt $timeout ] && ! `xenstore-read -s / >/dev/null 2>&1` ; do
+                while [ $time -lt $timeout ] && ! `${BINDIR}/xenstore-read -s / >/dev/null 2>&1` ; do
                     echo -n .
                    time=$(($time+1))
                     sleep 1
@@ -107,16 +109,14 @@ do_start () {
                fi
 
                echo Setting domain 0 name...
-               xenstore-write "/local/domain/0/name" "Domain-0"
+               ${BINDIR}/xenstore-write "/local/domain/0/name" "Domain-0"
        fi
 
        echo Starting xenconsoled...
        test -z "$XENCONSOLED_TRACE" || XENCONSOLED_ARGS=" --log=$XENCONSOLED_TRACE"
-       xenconsoled --pid-file=$XENCONSOLED_PIDFILE $XENCONSOLED_ARGS
-       test -z "$XENBACKENDD_DEBUG" || XENBACKENDD_ARGS="-d"
-       test "`uname`" != "NetBSD" || xenbackendd $XENBACKENDD_ARGS
+       ${SBINDIR}/xenconsoled --pid-file=$XENCONSOLED_PIDFILE $XENCONSOLED_ARGS
        echo Starting QEMU as disk backend for dom0
-       test -z "$QEMU_XEN" && QEMU_XEN=/usr/lib/xen/bin/qemu-system-i386
+       test -z "$QEMU_XEN" && QEMU_XEN="${LIBEXEC}/qemu-system-i386"
        $QEMU_XEN -xen-domid 0 -xen-attach -name dom0 -nographic -M xenpv -daemonize \
                -monitor /dev/null -serial /dev/null -parallel /dev/null \
                -pidfile $QEMU_PIDFILE
@@ -144,7 +144,7 @@ case "$1" in
        do_start
        ;;
   status)
-        xenstore-read -s /
+        ${BINDIR}/xenstore-read -s /
        ;;
   stop)
        do_stop
index 0fd7b1681f125819012cc339ab880b4a187260c0..5f92cdc6e90829bc77fbdc50bd20e52459a26090 100755 (executable)
@@ -18,6 +18,8 @@
 # Description:       Starts and stops the Xen control daemon.
 ### END INIT INFO
 
+. /etc/xen/scripts/hotplugpath.sh
+
 shopt -s extglob
 
 # Wait for Xend to be up
@@ -25,12 +27,12 @@ function await_daemons_up
 {
        i=1
        rets=10
-       xend status
+       ${SBINDIR}/xend status
        while [ $? -ne 0 -a $i -lt $rets ]; do
            sleep 1
            echo -n .
            i=$(($i + 1))
-           xend status
+           ${SBINDIR}/xend status
        done
 }
 
@@ -48,21 +50,21 @@ case "$1" in
        else
                touch /var/lock/xend
        fi
-       xend start
+       ${SBINDIR}/xend start
        await_daemons_up
        ;;
   stop)
-       xend stop
+       ${SBINDIR}/xend stop
        rm -f /var/lock/subsys/xend /var/lock/xend
        ;;
   status)
-       xend status
+       ${SBINDIR}/xend status
        ;;
   reload)
-        xend reload
+        ${SBINDIR}/xend reload
         ;;
   restart|force-reload)
-       xend restart
+       ${SBINDIR}/xend restart
        await_daemons_up
        ;;
   *)
index 00e5944dfdbe925e0f16305fbed0fb1e1d9294f6..2a1999a8b22b735bb45b45e399e7183910565adf 100644 (file)
 #                    boots / shuts down.
 ### END INIT INFO
 
-CMD=xm
+. /etc/xen/scripts/hotplugpath.sh
+
+CMD=${SBINDIR}/xm
 $CMD list &> /dev/null
 if test $? -ne 0
 then
-       CMD=xl
+       CMD=${SBINDIR}/xl
 fi
 
 $CMD list &> /dev/null